using System.Net;
using LiJ.Common.Core.Enums;

namespace LiJ.Common.Core
{
	/// <summary>
	/// 结果实体
	/// </summary>
	public class ResultMo
	{
		/// <summary>
		/// 返回结果
		/// 一般情况下：
		///  0  成功
		///  13xx   参数相关错误 
		///  14xx   用户授权相关错误
		///  15xx   服务器内部相关错误信息
		///  16xx   系统级定制错误信息，如升级维护等
		/// 也可依据第三方自行定义数值
		/// </summary>
		public int Ret
		{
			get;
			set;
		}

		/// <summary>
		/// 状态信息(错误描述等)
		/// </summary>
		public string Msg
		{
			get;
			set;
		}

		/// <summary>
		/// 空构造函数
		/// </summary>
		public ResultMo()
		{
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="ret"></param>
		/// <param name="message"></param>
		public ResultMo(int ret, string message = "")
		{
            Ret = ret;
            Msg = message;
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="ret"></param>
		/// <param name="message"></param>
		public ResultMo(ResultTypes ret, string message = "")
		{
            Ret = (int)ret;
            Msg = message;
		}
	}
	/// <summary>
	/// 自定义泛型的结果实体
	/// </summary>
	/// <typeparam name="TType"></typeparam>
	public class ResultMo<TType> : ResultMo
	{
		/// <summary>
		///  结果类型数据
		/// </summary>
		public TType Data
		{
			get;
			set;
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		public ResultMo()
		{
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="data"></param>
		public ResultMo(TType data)
		{
            Data = data;
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="ret"></param>
		/// <param name="message"></param>
		public ResultMo(int ret, string message = "")
			: base(ret, message)
		{
		}

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="ret"></param>
		/// <param name="message"></param>
		public ResultMo(ResultTypes ret, string message = "")
			: base(ret, message)
		{
		}
	}
}
